<?php

namespace App\Http\Controllers\Api;

use App\Http\Resources\BaseResource;
use App\Repositories\Contracts\PlatformInterface;
use App\Repositories\Contracts\PolicyInterface;
use Illuminate\Http\Request;

class SnailController
{

    private $platformInterface;
    private $policyInterface;
    public function __construct(PlatformInterface $platformInterface,PolicyInterface $policyInterface)
    {
        $this->platformInterface = $platformInterface;
        $this->policyInterface = $policyInterface;
    }

    /**
     * 上传政策
     * @param Request $request
     * @return BaseResource
     */
    public function uploadPolicy(Request $request){

        $flightLineData = $request->all();

        if ($flightLineData) {

            //获取所有规则
            $policy = $this->policyInterface->get(['status'=>1]);

            //上传政策
            $res = $this->platformInterface->uploadPolicy($flightLineData,$policy);
            return new BaseResource([]);
        }


    }
}